<?php
use yii\helpers\Url;
use yii\helpers\Html;
use yii\widgets\LinkPager;
$this->title='行业资讯';
?>
<link href="/static/css/public-same.css" rel="stylesheet">
<link href="/static/css/question.css" rel="stylesheet">

<!-- main-area -->
<div class="main-area QA-area" style=" background: #f5f5f5;">
<div class="container">
<div class="column-layout">
<!-- main-area-left start  -->
<div class="column-col main-area-left">
<div class="main-area-leftin">
<div class="ibox">
    <div class="ibox-in">
        <div class="ibox-head row">
            <div class="col-left">
                <span class="text-group">
                    <a class="item active" href="">行业资讯</a>
                    
                </span>
            </div>
            

        </div>
        
        <!-- 活动列表  -->
        <div class="ibox-body">
            <div class="article-list">
            
    
            <?php if(!empty($artlist)){ foreach ($artlist as $key => $art) {?>
            <!-- item -->
            <div class="item">
                <div class="col-left">
                    <a target="_blank" href="<?= Url::to(['operate/detail'])?>?article_id=<?= Html::encode($art['article_id'])?>" class="col-in count" name="<?= Html::encode($art['article_id'])?>">
                        <img alt="" src="http://admin.bwphp.com/<?= Html::encode($art['article_thumb'])?>">
                    </a>
                </div>
                <div class="col-right">
                    <div class="col-in">
                        <h3><a target="_blank" href="<?= Url::to(['operate/detail'])?>?article_id=<?= Html::encode($art['article_id'])?>" class="count" name="<?= Html::encode($art['article_id'])?>">
                        <?php
                              $str = $art['article_title'];
                              if(strlen($str)<30){
                                            echo $str;
                                        }else{
                                $num = mb_substr($str,0,30,'utf-8');
                                $rrr  = str_replace($str,$num."...",$str);
                                echo $rrr;
                              }  
                            ?></a></h3>
                        <p style="word-break:break-all" class="article-abstract">【文章摘要】<?= Html::encode($art['article_descripte'])?><a target="_blank" name="<?= Html::encode($art['article_id'])?>" href="<?= Url::to(['operate/detail'])?>?article_id=<?= Html::encode($art['article_id'])?>" class="count">查看全文</a></p>
                        
                            <div class="article-about">
                                <span class="hot-tag-group"><a href="javascript:void(0)" class="hot-tag"><?= Html::encode($art['artlable_name'])?></a></span>
                            </div>
                        
                        <div class="article-about">
                            <div style="" class="article-about-user">

                                <div>作者:<span class="u-name"><?= Html::encode($art['article_author'])?></span>
                                </div>
                                <span class="u-datetime">
                    <?php  
                        $dur = time()-$art['article_addtime'];
                        /*暂时没想到怎么做、先做成这样的*/
                        if($dur<60){
                            echo $dur."秒前";
                        }else{
                            if($dur<3600){
                                echo floor($dur/60)."分钟前";
                            }else{
                                if($dur<86400){
                                    echo floor($dur/3600)."小时前";
                                }else{
                                    if($dur<604800){
                                        echo floor($dur/86400)."天前";
                                    }else{
                                        if($dur<2592000){
                                            echo floor($dur/604800)."周前";
                                        }else{
                                            if($dur<31104000){
                                                echo floor($dur/2592000)."月前";
                                            }else{
                                                if($dur>31104000){
                                                    echo floor($dur/31104000)."年前";
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        if(isset($year)){
						echo $year;
						}
                    ?>
                                </span>

                            </div>
                            <div class="col-right">
                                <span class="u-view">浏览(<?= Html::encode($art['article_count'])?>)</span>   
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        <?php } }else{?>
            <div class="item">
                <div class="col-left">
                <h3>抱歉、暂时没有这项内容！</h3>
                </div>
            </div>     
        <?php }?>

            
            
            
            </div>
<div align="center">
        <?php 
            echo LinkPager::widget([
                    'pagination' => $pages,
                    'prevPageLabel'=>'上一页',
                    'nextPageLabel'=>'下一页',
                ]);
        ?>
</div>

            
        </div>
    </div>
</div>
</div>
</div>
<!-- main-area-left end  -->

<?php echo $this->render('commen')?>

</div>
</div>
</div>
</div>
<script>
    $(".count").click(function(){
        var article_id = $(this).attr("name");
        $.ajax({
                type: "POST",
                url: "<?= Url::to(['operate/count'])?>",
                data: "article_id="+article_id,
                success: function(){
                    
                }
            })
    })
</script>